package com.fupan.Topic;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TopicConfig {


    //主题类型的交换机
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("topicExchange");
    }

    @Bean
    public Queue xingHaoQueue(){
        return new Queue("xingHaoQueue");
    }


    @Bean
    public Queue jingHaoQueue(){
        return new Queue("jingHaoQueue");
    }


    @Bean
    public Binding xingHaoBinding(){
        return BindingBuilder.bind(xingHaoQueue())
                .to(topicExchange())
                .with("big.*");  //*代表一个词
    }

    @Bean
    public Binding jingHaoBinding(){
        return BindingBuilder.bind(jingHaoQueue())
                .to(topicExchange())
                .with("big.#");  //#代表多个词
    }

}